Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
Mac and OpenDoc are trademarks of Apple Computer, Inc.
Introduction
In order to be DSOM ready, OpenDoc uses ODByteArray (which is a sequence of octets) for varible length parameters. The ODByteArray utilities are used to manipulate these ODByteArray.
The utilities are written as procedural functions so that they can be used in both C and C++.
ODByteArray Utilities
Construction
Several functions are provided for construction of ODByteArray:
Allocates an ODByteArray on the stack with a buffer of the specified size.
Destruction
void DisposeByteArray(ODByteArray* array);
Deallocates both the buffer and the structure of the ODByteArray. The ODByteArray must be allocated in the default heap.
void DisposeByteArrayStruct(ODByteArray* array);
Deallocates the buffer allocated in CreateEmptyByteArrayStruct and CreateByteArrayStruct. The struct itself is deallocated from the stack when the caller function exits its scope.
Given an ODByteArray struct, put the pointer to the buffer and size into the appropriate fields. If the ODByteArray contains other values, they will be overwritten by the new values.
Duplication
ODByteArray* CopyByteArray(ODByteArray* fromBA);
Allocates an ODByteArray in the default heap and copies the buffer from the specified ODByteArray to the new one.